// pages/main/xiaoque/updateXiao/updateXiao.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    solvetaskcode:'',
    solveTaskName:'',
    taskStatusId:0,
    workDocTypeId:0,
    taskmanagername:'',
    issuedtime:'',
    issuedbyname:'',
    taskdesc:'',
    common:'',
    taskStatus:['待分配','已分配','执行中','已完成','审查通过','驳回'],
    workDocStatus:['任务单','第一种单据','第二种单据']
  },
  bindsolvetaskcodeChange(e){
    this.setData({
      solvetaskcode: e.detail.value
    })
  },
  bindsolveTaskNameChange(e){
    this.setData({
      solveTaskName: e.detail.value
    })
  },
  bindtaskStatusIdChange(e){
    this.setData({
      taskStatusId: e.detail.value
    })
  },
  bindworkDocTypeIdChange(e){
    this.setData({
      workDocTypeId: e.detail.value
    })
  },
  bindtaskmanagernameChange(e){
    this.setData({
      taskmanagername: e.detail.value
    })
  },
  bindtaskdescChange(e){
    this.setData({
      taskdesc: e.detail.value
    })
  },
  bindcommonChange(e){
    this.setData({
      common: e.detail.value
    })
  },
  update(res){
    wx.showModal({
      title:'是否做出更改',
      showCancel:true,//默认为true 如果写false的话就会变成只有确认
      cancelText:"取消",
      confirmText:"确认",
      success:ref=>{
        console.log(this.data)
        wx.request({
          url: 'http://localhost:8080/updateXiao',
          data:{
            solvetaskcode:this.data.solvetaskcode,
            solveTaskName:this.data.solveTaskName,
            taskStatusId:this.data.taskStatusId,
            workDocTypeId:this.data.workDocTypeId,
            taskmanagername:this.data.taskmanagername,
            issuedtime:this.data.issuedtime,
            issuedbyname:this.data.issuedbyname,
            taskdesc:this.data.taskdesc,
            common:this.data.common
          },
          success:res=>{
            console.log(res)
          }
        })
        
      }
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    wx.request({
      url: 'http://localhost:8080/selectXiaoById?id='+options.id,
      success:ref=>{
        console.log(ref)
        this.setData({
          solvetaskcode:ref.data.solvetaskcode,
          solveTaskName:ref.data.solveTaskName,
          taskStatusId:ref.data.taskStatusId,
          workDocTypeId:ref.data.workDocTypeId,
          taskmanagername:ref.data.taskmanagername,
          issuedtime:ref.data.issuedtime,
          issuedbyname:ref.data.issuedbyname,
          taskdesc:ref.data.taskdesc,
          common:ref.data.common
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})